﻿using System;
using System.Linq;

namespace Database.Sql
{
  internal static class Extentions
  {
    internal static bool IsSqlConvertableType(this Type type)
    {
      return type.IsValueType ||
             type.IsPrimitive ||
             new[]
             {
               typeof (string),
               typeof (decimal),
               typeof (DateTime),
               typeof (DateTimeOffset),
               typeof (TimeSpan),
               typeof (Guid)
             }.Any(t => t == type)
             || Convert.GetTypeCode(type) != TypeCode.Object;
    }
  }
}
